<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="error_Page.jsp" %>
<%!
	String SID,StudentName,Password,Father_Name,DOB,Nationality,Address,City,Country,Phone,Mobile,NIC,Email;
	Connection conn=null;
	Statement stmt=null;
	ResultSet rs=null;	
%>
<% 
String sid=(String)session.getAttribute("id");
String sname=(String)session.getAttribute("name");
	if(sid==null)
	response.sendRedirect("http://localhost:8080/expired.html");
	else
try{
    SID=request.getParameter("T1");
    StudentName=request.getParameter("T2");
    Password=request.getParameter("T3");
    Father_Name=request.getParameter("T4");
    DOB=request.getParameter("T5");
    Nationality=request.getParameter("T6");
    Address=request.getParameter("T7");
    City=request.getParameter("T8");
    Country=request.getParameter("T9");
    Phone=request.getParameter("T10");
    Mobile=request.getParameter("T11");
    NIC=request.getParameter("T12");
    Email=request.getParameter("T13");
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	conn=DriverManager.getConnection("jdbc:odbc:sis");
	stmt=conn.createStatement();
	String Query="INSERT INTO Student VALUES('"+SID+"','"+StudentName+"','"+Password+"','"+Father_Name+"','"+DOB+"','"+Nationality+"','"+Address+"','"+City+"','"+Country+"','"+Phone+"','"+Mobile+"','"+NIC+"','"+Email+"')";
    int chk=stmt.executeUpdate(Query);
	if(chk==1)
	out.println("Student has been Registered Successfully!");
	else
	out.println("Failed to Register New Student");
}
	catch(Exception e){
		out.println("Exception has been Occured"+e.getMessage());
	}
 %>
<html>
<head>
<title>Redirecting You to Main Page</title>
<meta http-equiv="refresh"  content="5 ; url=AdminSIS.jsp">
</head>
<body>

<p><strong><font color="#999999" face="Courier New, Courier, mono">Redirecting 
you to Home Page</font></strong> </p>
<p align="center">
<img border="0" src="images/redirect.JPG" width="200" height="250"></p>

</body>
</html>
